<?php
/***************
* @Project	Warabi
* @Author	Feifei
* @Date		04/06/2009
***************/

/***database config****/
$wbDBserver = '127.0.0.1';
$wbDBuser = 'root';
$wbDBpassword = 'nimda12345qwert';
$wbDBname = 'warabi';
$wbDBport = '3306';

/***table config***/
define("__table_dpf_user__" , "dpf_user");
define("__table_app_user__" , "app_user");
define("__table_card_info__" , "card_info");
define("__table_card_list__" , "card_list");


/**message response for errors***/
define("app_useradd_error" , "The AP username is missing.");
define("dpf_teladd_error_tel" , "The DPF phone number is missing.");
define("dpf_teladd_error_dev" , "The DPF device id is missing.");
define("dpf_teladd_error_model" , "The DPF model name is missing.");
define("dpf_teladd_error_minw" , "The DPF min width is missing.");
define("dpf_teladd_error_minh" , "The DPF min height is missing.");
define("dpf_teladd_error_defw" , "The DPF def width is missing.");
define("dpf_teladd_error_defh" , "The DPF def height is missing.");


/**response message **/
define("success_response" , "HTTP/1.1 201 OK");
define("error_url_param_missing" , "HTTP/1.1 400 Bad Request");
define("error_autorized_header" , "HTTP/1.1 401 Unauthorized");
define("error_xml_element_missing" , "HTTP/1.1 403 Forbidden");
define("error_xml_structure","HTTP/1.1 406 Not Acceptable");
define("error_server_system","HTTP/1.1 500 Internal Server Error");

/** server state **/
#$wbIP = "192.168.0.19";
#$wbIP = '127.0.0.1';
$wbIP = '61.58.40.112:8359';
$wbConfig = array();

getConfig();
define("expire_time" , $wbConfig[0]["value"]);
define("expire_unit" , "day");
define("number_copy" , $wbConfig[1]["value"]);
define("number_photo" , $wbConfig[2]["value"]);
define("description_lang" , "ja");
define("description_message" , "this is a message tip");
define("default_quality" , $wbConfig[3]["value"]);
define("sent_expire_time" , $wbConfig[4]["value"]);

function getConfig(){
	global $wbDBserver , $wbDBuser , $wbDBpassword , $wbDBname , $wbConfig;
	$db = new mysqli($wbDBserver , $wbDBuser , $wbDBpassword , $wbDBname);
	if (mysqli_connect_errno()){
		echo 'Error : Could not connect to database. Please try again later';
		exit;
	}
	$sql = "select * from config";
	if ($result = $db->query($sql)){
		while ($row = $result->fetch_assoc()) {
			$wbConfig[] = $row;
		}
		$result->close();
	}
	$db->close();
}


/** invitation card uri **/
$wbInvitationUri = "http://".$wbIP."/func/dpf/card_magic_uri.php";
$wbListLimit = 16;

/** google picasa provided size ***/
$wbPicasaWidth = array(32,48,64,72,94,104,110,128,144,150,160,200,220,288,320,400,512,576,640,720,800,912,1024,1152,1280,1440,1600);
define('thumb_width' , 48);
define('link_prefix' , 's');
?>